package com.xw.controller;


import cn.hutool.db.Page;
import com.xw.service.IReserveService;
import com.xw.vo.ResultVO;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author y
 * @since 2021-09-15
 */
@RestController
@RequestMapping("/reserve")
public class ReserveController {

    private final IReserveService reserveService;

    public ReserveController(IReserveService reserveService) {
        this.reserveService = reserveService;
    }

    /**
     * 添加预定门票
     *
     * @param openId
     * @param reserveTime
     * @param userList
     * @param remark
     * @return
     */
    @PostMapping("/reserveTickets")
    public ResultVO reserveTickets(@RequestParam("openId") String openId,
                                   @RequestParam("reserveTime") String reserveTime,
                                   @RequestParam("userList") String userList,
                                   @RequestParam("remark") String remark) {
        return reserveService.reserveTickets(openId, reserveTime, userList, remark);
    }


    /**
     * 列表预定
     */
    @GetMapping("/findReserveList")
    public ResultVO<?> findReserveList(Page page, HttpServletRequest request) {
        return reserveService.findReserveList(page, request);
    }


    /**
     * 可预定日期
     */
    @GetMapping("/findReserveDate")
    public ResultVO<?> findReserveDate() {
        return reserveService.findReserveDate();
    }


    /**
     * 查询已预定信息
     */
    @GetMapping("/findReserveItemList")
    public ResultVO<?> findReserveItemList(@RequestParam("openId") String openId) {
        return reserveService.findReserveItemList(openId);
    }


}

